<?php
include 'header.php';
?>
<div style="margin-left:20px">
<h2>Daftar Produk</h2>
<h3>Tag <?php echo $tags;?></h3>
</div>
<?php
$id_user = $this->session->userdata('id_user');
$username = $this->session->userdata('username');
if(count($produk)){
		foreach($produk as $data){
			foreach($data['tag'] as $rows)
	  ?>

<div class="panel panel-primary" style="margin-right:10px">
  <!-- Default panel contents -->
  <div class="panel-heading">
  </div>
  <div class="panel-body">
   <div class="hero-unit">
		<div class="media">
			<a class="pull-left" href="#">
				<img class="media-object" src="http://localhost/<?php echo $rows['gambar']; ?> " height="100" alt="">
			</a>
			<div class="media-body">
				<h4 class="media-heading"><?php echo $rows['nama_produk']; ?></h4>
				<?php 
				echo $rows['ket_produk'];
				?>
				</div>
				<p> 
				<?php
				echo 'Harga: Rp '.$rows['harga'];
				?>
				</p>
		</div>
	<?php
	if($id_user){
	if($id_user != 1){
      if($cart != null){
	?>
	<a class="btn btn-primary btn-large" href="<?php echo base_url().'index.php/cart/insert_cart/'.$rows['id_produk'].'/'.$cart->id_cart; ?>">Add to cart</a>
	<?php
	} else {
	
	}
	} else {}
	}
	?>
	  
   </div>
</div>

</div>
<?php
}
if($id_user){
if($id_user != 1){
if($cart == null){
	?>
	<a class="btn btn-primary btn-large" href="<?php echo base_url().'index.php/cart/m_cart/'.$id_user; ?>">Make cart</a>
	<?php
	} else {
	?>
		<a class="btn btn-primary btn-large" href="<?php echo base_url().'index.php/cart/view_cart/'.$id_user; ?>">View Cart</a>
	<?php
	}
} else {}
}
?>
<a class="btn btn-primary btn-large" href= "<?php echo base_url().'index.php/produk/' ?>">Kembali ke daftar produk</a>
<?php
}

?>